package com.kws.merchant.mapper;

import com.kws.merchant.domain.OperationPolling;
import com.kws.merchant.domain.OperationWorkOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 运维-工单管理(OperationWorkOrder)表数据库访问层
 *
 * @author yxy
 * @since 2024-10-26 12:27:15
 */

public interface OperationWorkOrderMapper extends BaseMapper<OperationWorkOrder> {



    @Select("select count(*) from tb_operation_work_order o left join tb_item i on o.item_id=i.id left join tb_merchant m on m.id=o.merchant_id where ${sql};")
    int countToTal(@Param("sql") String sql);

    @Select("select o.*,i.item_name,m.company_name as merchant_name,u.nick_name as processorName from tb_operation_work_order o left join tb_item i on o.item_id=i.id left join tb_merchant m on m.id=o.merchant_id left join sys_user u on o.processor=u.user_id where ${sql} limit ${sizeNum},${totalPage}; ")
    List<OperationWorkOrder> getRecords(@Param("sql") String sql, @Param("sizeNum") int sizeNum, @Param("totalPage") Integer totalPage);

    @Select("select count(*) from tb_operation_work_order where merchant_id=${companyId} ${sql};")
    Double countWorkTypeBySql(@Param("companyId") Long companyId,@Param("sql") String sql);
}
